/**
 * 现金收费——打折收费
 * @author shuang
 * @date 2021/12/12 23:49
 */
public class CashRebate extends CashSuper {

    /**
     * 折扣率
     */
    private double moneyRebate = 1d;

    /**
     * 初始化时指定折扣率，0.8 表示打 8 折
     * @param moneyRebate 折扣率
     */
    public CashRebate(String moneyRebate) {
        this.moneyRebate = Double.parseDouble(moneyRebate);
    }

    @Override
    public double acceptCash(double money) {
        return money * moneyRebate;
    }
}

